import axios from 'axios'


/* 封装get方法 */
export function get(url, params = {}) {
    return new Promise((resolve, reject) => {
        axios
            .get(url, {
                params: params
            })
            .then(response => {
                resolve(response.data)
            })
            .catch(err => {
                reject(err)
            })
    })
}


export function islogin() {
    var uid = localStorage.getItem('uid')
    if (!uid) {
        // console.log(window.location.href)
        // console.log(this.$route.name)
        this.$router.replace({ name: 'login', params: { 'beforeurl': this.$route.name } })
    } else {
        console.log('已经登录')
    }
}




